package com.ap.core.validation.message.rules;

import com.ap.core.dao.RefundMethodDao;
import com.ap.core.domain.RefundMethod;
import com.ap.core.message.managerefund.info.RequestRetrieveRefundAccountInfo;
import com.ap.core.validation.message.info.MessageValidationInfo;
import com.ap.core.validation.message.info.OriginalInfo;
import com.ap.core.validation.rules.AbstractValidationRule;

/**
 * User: Gibu.Paul 
 * The RefundMethod does not match a value in Database
 */

public class RV0018Rule
		extends
		AbstractValidationRule<MessageValidationInfo<RequestRetrieveRefundAccountInfo, OriginalInfo>> {

	private RefundMethodDao refundMethodDao;

	@Override
	public boolean validate(MessageValidationInfo<RequestRetrieveRefundAccountInfo, OriginalInfo> infoObject) {
		String refundMethodCode = null;
		refundMethodCode = infoObject
				.getBoundObject().getRefundRequestInfo().getRefundMethod();
		final RefundMethod refundMethod = refundMethodDao
				.findById(refundMethodCode);
		return null != refundMethod;
	}

	public void setrefundMethodDao(RefundMethodDao refundMethodDao) {
		this.refundMethodDao = refundMethodDao;
	}

}